import scrapy

class FlaticonSpider(scrapy.Spider):
    name = 'flaticon'
    start_urls = [
            'http://www.flaticon.com/packs/international-flags'
    ]

    def parse(self, response):
        for flat in response.css("section.search-result li.icon"):
            yield {
                'name': flat.css('img::attr(alt)').extract_first(),
                'url': flat.css('img::attr(src)').extract_first(),
            }
            next_page = response.css('a#pagination-more::attr(href)').extract_first()
            if next_page is not None:
                next_page = response.urljoin(next_page)
                yield scrapy.Request(next_page, callback=self.parse)
